package com.devperson.io.bio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 功能描述:
 *
 * @author lixiaomeng
 * @date 2018/12/14
 */
public class InputUtils {

    // 获取键盘的输入操作流
    private static BufferedReader KEY_BORD_INPUT = new BufferedReader(new InputStreamReader(System.in));

    private InputUtils(){}

    public static String getInputInfo(String promat) {
        boolean flag = true;
        String str = null;
        while (flag) {
            System.out.println(promat);
            try {
                str = KEY_BORD_INPUT.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (str == null || "".equals(str)) {
                System.out.println("输入数据不能为空：");
            } else {
                flag = false;
            }
        }
        return str;
    }
}
